﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Library
{
    public abstract class Person
    {
        private string firstName;
        private string lastName;
        private ulong eGN;
        private string address;

        public string FirstName
        {
            get
            {
                return this.firstName;
            }
            set
            {
                if (value == null || value == string.Empty)
                {
                    throw new ArgumentNullException("The first name can not be blank.");
                }
                this.firstName = value;
            }
        }

        public string LastName
        {
            get
            {
                return this.lastName;
            }
            set
            {
                if (value == null || value == string.Empty)
                {
                    throw new ArgumentNullException("The last name can not be blank.");
                }
                this.lastName = value;
            }
        }

        public ulong EGN
        {
            get
            {
                return this.eGN;
            }
            set
            {
                if (value.ToString().Trim().Length != 10)
                {
                    throw new FormatException("Invalid EGN. It must be 10 numbers.");
                }
                this.eGN = value;
            }
        }

        public string Address
        {
            get
            {
                return this.address;
            }
            set
            {
                if (value == null || value == string.Empty)
                {
                    throw new ArgumentNullException("The address can not be blank.");
                }
                this.address = value;
            }
        }

        public Person(string firstName, string lastName, ulong eGN, string address)
        {
            this.FirstName = firstName;
            this.LastName = lastName;
            this.EGN = eGN;
            this.Address = address;
        }
    }
}
